package com.zyf.chapter02.behavior.state.mario.refactor.v2;

import com.zyf.chapter02.behavior.state.mario.State;

/**
 * 初始状态 小马里奥
 * @author yifeng
 */
public class SmallMario implements IMario {
    private static final SmallMario INSTANCE = new SmallMario();

    private SmallMario() {

    }

    public static SmallMario getInstance() {
        return INSTANCE;
    }

    @Override
    public State getName() {
        return State.SMALL;
    }

    @Override
    public void obtainMushRoom(MarioStateMachine marioStateMachine) {
        marioStateMachine.setCurrentState(SuperMario.getInstance());
        marioStateMachine.setScore(marioStateMachine.getScore() + 100);
    }

    @Override
    public void obtainCape(MarioStateMachine marioStateMachine) {
        marioStateMachine.setCurrentState(CapeMario.getInstance());
        marioStateMachine.setScore(marioStateMachine.getScore() + 200);
    }

    @Override
    public void obtainFireFlower(MarioStateMachine marioStateMachine) {
        marioStateMachine.setCurrentState(FireMario.getInstance());
        marioStateMachine.setScore(marioStateMachine.getScore() + 300);
    }

    @Override
    public void meetMoster(MarioStateMachine marioStateMachine) {
        // do nothing...
    }
}
